//
//  AuctionSoreShopCollectionCell.m
//  MyNewProject
//
//  Created by 王春辉 on 2020/1/4.
//  Copyright © 2020年 sun. All rights reserved.
//

#import "AuctionSoreShopCollectionCell.h"

@interface AuctionSoreShopCollectionCell()

@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *priceLabel;
@end

@implementation AuctionSoreShopCollectionCell
@synthesize imageView = _imageView;

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = [UIColor whiteColor];
        self.layer.masksToBounds = true;
        self.layer.cornerRadius = 4.0;
        [self initContentViews];
    }
    return self;
}

- (void)initContentViews {
    [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.top.mas_offset(0);
        make.height.mas_equalTo(self.imageView.mas_width);
    }];
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_offset(12);
        make.right.mas_offset(-12);
        make.top.mas_equalTo(self.imageView.mas_bottom).mas_offset(12);
    }];
    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.height.mas_equalTo(self.titleLabel);
        make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(10);
        make.bottom.mas_offset(-12);
    }];
}

#pragma mark -- mark 懒加载
- (UIImageView *)imageView {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] initWithImage:SKIMAGE_NAMED(@"logo")];
        _imageView.layer.masksToBounds = true;
        [self addSubview:_imageView];
    }
    return _imageView;
}

- (UILabel *)titleLabel {
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc] init];
        _titleLabel.text = @" ";
        _titleLabel.font = SKFONT_Medium(13);
        _titleLabel.textColor = SKColorWithHex(0x333333);
        [self addSubview:_titleLabel];
    }
    return _titleLabel;
}
- (UILabel *)priceLabel {
    if (!_priceLabel) {
        _priceLabel = [[UILabel alloc] init];
        _priceLabel.text = @" ";
        _priceLabel.font = SKFONT_Medium(12);
        _priceLabel.textColor = SKColorWithHex(0xFF3030);
        [self addSubview:_priceLabel];
    }
    return _priceLabel;
}


#pragma mark -- mark 业务逻辑

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}
- (void)setPrice:(NSString *)price {
    _price = price;
    self.priceLabel.text = [NSString stringWithFormat:@"需%@积分兑换", price];
}
@end
